<?php
/*
 +----------------------------------------------------------------------
 + Title        : Mysql 控制器
 + Author       : Randy_chen
 + Version      : V1.0.0.1
 + Initial-Time : 2023/12/23 7:57
 + Last-time    : 2023/12/23 7:57+ chen2
 + Desc         : Mysql
 +----------------------------------------------------------------------
*/


namespace randy\tools\log;

use app\common\model\Log;
use think\contract\LogHandlerInterface;
use think\facade\Db;

class Mysql implements LogHandlerInterface
{
    public function report(){

    }

    public function save(array $log) : bool
    {
        foreach ($log as $k => $item){
            Log::build()->save([
                'url' => request()->url(true),
                'trade_id' => request()->trade_id,
                'type' => $k,
                'create_time' => date('Y-m-d H:i:s'),
                'msg' => $item
            ]);
        }
        return true;
    }
}